<template>
  <view class="production-container">
    <!-- 头部标题区域 -->
    <view class="header-section">
      <view class="header-content">
        <text class="main-title">生产管理系统</text>
        <text class="sub-title">easy your work</text>
      </view>
    </view>

    <!-- 卡片区域 -->
    <view class="cards-container">
      <!-- 第一个卡片独占一行 -->
      <view class="card-row single">
        <view class="card-item" @click="handleCardClick('施工日志填报')">
          <view class="card-icon">
            <uni-icons type="compose" size="40" color="#1890ff"></uni-icons>
          </view>
          <view class="card-content">
            <text class="card-title">施工日志填报</text>
            <text class="card-desc">记录每日施工情况</text>
          </view>
        </view>
      </view>

      <!-- 停工日志填报卡片 -->
      <view class="card-row single">
        <view class="card-item" @click="handleCardClick('停工日志填报')">
          <view class="card-icon">
            <uni-icons type="locked" size="40" color="#ff6b6b"></uni-icons>
          </view>
          <view class="card-content">
            <text class="card-title">停工日志填报</text>
            <text class="card-desc">记录每日停工情况</text>
          </view>
        </view>
      </view>

      <!-- 其余六个卡片，一行两个 -->
      <view class="card-row double">
        <view class="card-item" @click="handleCardClick('部门制度')">
          <view class="card-icon">
            <uni-icons type="list" size="30" color="#52c41a"></uni-icons>
          </view>
          <view class="card-content">
            <text class="card-title">部门制度</text>
            <text class="card-desc">管理制度查看</text>
          </view>
        </view>
        <view class="card-item" @click="handleCardClick('日成本分析')">
          <view class="card-icon">
            <uni-icons type="wallet" size="30" color="#fa8c16"></uni-icons>
          </view>
          <view class="card-content">
            <text class="card-title">日成本分析</text>
            <text class="card-desc">成本统计分析</text>
          </view>
        </view>
      </view>

      <view class="card-row double">
        <view class="card-item" @click="handleCardClick('视频班会')">
          <view class="card-icon">
            <uni-icons type="videocam" size="30" color="#722ed1"></uni-icons>
          </view>
          <view class="card-content">
            <text class="card-title">视频班会</text>
            <text class="card-desc">在线会议管理</text>
          </view>
        </view>
        <view class="card-item" @click="handleCardClick('项目过程资料')">
          <view class="card-icon">
            <uni-icons type="folder" size="30" color="#13c2c2"></uni-icons>
          </view>
          <view class="card-content">
            <text class="card-title">项目过程资料</text>
            <text class="card-desc">资料文档管理</text>
          </view>
        </view>
      </view>

      <view class="card-row double">
        <view class="card-item" @click="handleCardClick('安全检查')">
          <view class="card-icon">
            <uni-icons type="checkmarkempty" size="30" color="#f5222d"></uni-icons>
          </view>
          <view class="card-content">
            <text class="card-title">安全检查</text>
            <text class="card-desc">安全巡检管理</text>
          </view>
        </view>
        <view class="card-item" @click="handleCardClick('成本发生记录')">
          <view class="card-icon">
            <uni-icons type="bars" size="30" color="#eb2f96"></uni-icons>
          </view>
          <view class="card-content">
            <text class="card-title">成本发生记录</text>
            <text class="card-desc">成本记录管理</text>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      // 可以在这里添加数据
    }
  },
  methods: {
    handleCardClick(cardName) {
      console.log('点击卡片:', cardName)

      // 根据卡片名称跳转到对应页面
      switch (cardName) {
        case '施工日志填报':
          this.navigateToConstructionLog()
          break
        case '停工日志填报':
          this.navigateToStoppageLog()
          break
        case '部门制度':
          this.navigateToDepartmentRules()
          break
        case '日成本分析':
          this.navigateToCostAnalysis()
          break
        case '视频班会':
          this.navigateToVideoMeeting()
          break
        case '项目过程资料':
          this.navigateToProjectMaterials()
          break
        case '安全检查':
          this.navigateToSafetyCheck()
          break
        case '成本发生记录':
          this.navigateToCostRecord()
          break
        default:
          uni.showToast({
            title: `点击了${cardName}`,
            icon: 'none'
          })
      }
    },

    // 跳转到施工日志页面
    navigateToConstructionLog() {
      uni.navigateTo({
        url: '/pages/work/production/construction-log'
      })
    },

    // 跳转到停工日志页面
    navigateToStoppageLog() {
      uni.navigateTo({
        url: '/pages/work/production/stoppage-log'
      })
    },

    // 其他页面跳转方法
    navigateToDepartmentRules() {
      uni.navigateTo({
        url: '/pages/work/production/department-rules'
      })
    },
    navigateToCostAnalysis() {
      uni.navigateTo({
        url: '/pages/work/production/daily-cost-analysis'
      })
    },
    navigateToVideoMeeting() {
      uni.navigateTo({
        url: '/pages/work/production/video-meeting'
      })
    },
    navigateToProjectMaterials() {
      uni.navigateTo({
        url: '/pages/work/production/project-materials'
      })
    },
    navigateToSafetyCheck() {
      uni.navigateTo({
        url: '/pages/work/production/safety-check'
      })
    },
    navigateToCostRecord() {
      uni.navigateTo({
        url: '/pages/work/production/cost-record'
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.production-container {
  min-height: 100vh;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  position: relative;
}

/* 头部标题区域 */
.header-section {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 80rpx 40rpx 100rpx;
  text-align: center;
  position: relative;
  overflow: hidden;

  /* 添加装饰性背景元素 */
  &::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: float 6s ease-in-out infinite;
  }

  &::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30rpx;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 0 0 50% 50%;
    box-shadow: 0 10rpx 20rpx rgba(0, 0, 0, 0.1);
  }
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0px) rotate(0deg);
  }

  50% {
    transform: translateY(-20px) rotate(180deg);
  }
}

.header-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 2;
}

.main-title {
  font-size: 52rpx;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 24rpx;
  text-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.2);
  letter-spacing: 2rpx;
  animation: slideInDown 0.8s ease-out;
}

.sub-title {
  font-size: 30rpx;
  color: rgba(255, 255, 255, 0.9);
  font-style: italic;
  font-weight: 300;
  letter-spacing: 1rpx;
  animation: slideInUp 0.8s ease-out 0.2s both;
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 卡片容器 */
.cards-container {
  padding: 50rpx 30rpx;
  margin-top: -30rpx;
  position: relative;
  z-index: 1;
}

.card-row {
  display: flex;
  margin-bottom: 30rpx;
  animation: fadeInUp 0.6s ease-out;

  &:nth-child(1) {
    animation-delay: 0.1s;
  }

  &:nth-child(2) {
    animation-delay: 0.2s;
  }

  &:nth-child(3) {
    animation-delay: 0.3s;
  }

  &:nth-child(4) {
    animation-delay: 0.4s;
  }

  &.single {
    .card-item {
      width: 100%;
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      color: white;

      .card-title {
        color: white;
        font-size: 36rpx;
      }

      .card-desc {
        color: rgba(255, 255, 255, 0.8);
      }

      .card-icon {
        background: rgba(255, 255, 255, 0.2);
        backdrop-filter: blur(10rpx);
      }
    }
  }

  &.double {
    .card-item {
      flex: 1;
      margin-right: 20rpx;

      &:last-child {
        margin-right: 0;
      }
    }
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-item {
  background: #ffffff;
  border-radius: 24rpx;
  padding: 40rpx 30rpx;
  box-shadow: 0 12rpx 32rpx rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  border: 1rpx solid rgba(255, 255, 255, 0.8);

  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8rpx;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 24rpx 24rpx 0 0;
  }

  &::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  &:hover {
    transform: translateY(-8rpx);
    box-shadow: 0 20rpx 40rpx rgba(0, 0, 0, 0.12);

    &::after {
      opacity: 1;
    }
  }

  &:active {
    transform: translateY(-4rpx);
    box-shadow: 0 16rpx 24rpx rgba(0, 0, 0, 0.15);
  }
}

.card-icon {
  margin-right: 30rpx;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 88rpx;
  height: 88rpx;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
  border-radius: 50%;
  transition: all 0.3s ease;
  position: relative;

  &::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60rpx;
    height: 60rpx;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
  }
}

.card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 2;
}

.card-title {
  font-size: 34rpx;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 12rpx;
  line-height: 1.3;
  transition: color 0.3s ease;
}

.card-desc {
  font-size: 26rpx;
  color: #718096;
  line-height: 1.4;
  transition: color 0.3s ease;
}

/* 响应式设计 */
@media screen and (max-width: 750rpx) {
  .header-section {
    padding: 60rpx 30rpx 80rpx;
  }

  .main-title {
    font-size: 44rpx;
    letter-spacing: 1rpx;
  }

  .sub-title {
    font-size: 26rpx;
  }

  .cards-container {
    padding: 40rpx 20rpx;
  }

  .card-item {
    padding: 32rpx 24rpx;
    border-radius: 20rpx;
  }

  .card-title {
    font-size: 30rpx;
  }

  .card-desc {
    font-size: 24rpx;
  }

  .card-icon {
    width: 76rpx;
    height: 76rpx;
    margin-right: 24rpx;
  }
}

/* 添加加载动画 */
.production-container {
  animation: pageLoad 0.8s ease-out;
}

@keyframes pageLoad {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 添加微妙的背景装饰 */
.production-container::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(102, 126, 234, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(118, 75, 162, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* 优化卡片悬停效果 */
.card-item:hover .card-icon {
  transform: scale(1.1);

  &::before {
    transform: translate(-50%, -50%) scale(1.2);
  }
}

.card-item:hover .card-title {
  color: #667eea;
}

.card-item:hover .card-desc {
  color: #4a5568;
}

/* 添加卡片进入动画的延迟效果 */
.card-row {
  &:nth-child(1) {
    animation-delay: 0.1s;
  }

  &:nth-child(2) {
    animation-delay: 0.2s;
  }

  &:nth-child(3) {
    animation-delay: 0.3s;
  }

  &:nth-child(4) {
    animation-delay: 0.4s;
  }
}

/* 优化第一个卡片的特殊效果 */
.card-row.single .card-item {
  box-shadow: 0 16rpx 40rpx rgba(102, 126, 234, 0.2);

  &:hover {
    box-shadow: 0 24rpx 48rpx rgba(102, 126, 234, 0.3);
    transform: translateY(-12rpx);
  }
}
</style>